<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags" %>
<!doctype html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<title>收邮件</title>
	
	<link href="/oas/css/style.css" rel="stylesheet" type="text/css" />
	<style type="text/css">
		table {text-align:center;width:90%;padding:5px;margin:0px;}
		.deleteMail{border:0;background-color: transparent;text-decoration:underline;}
	</style>
	
	<script type="text/javascript" src="/oas/js/jquery-1.11.3.min.js"></script>
	<script type="text/javascript">
	$(ducument).ready(
			function delMail(arg)
			{
				var con= confirm("确实执行此操作？");
				if(con){
					$("#ajax").load("/oas/email/removeEmail?confirm=true&eid="+arg);
				}
			},
			function emailDetails(arg){
				var url="/oas/email/emailDetails?eid="+arg;
				$("#ajax").load(url);
			},
			function changeColor(variable)
			{
				variable.style.color="red";
			},
			function recoverColor(variable)
			{
				variable.style.color="black";
			}	
	);
	</script>
</head>
<body>
	<div class="action">
		<div class="t">
			邮件信息列表
		</div>
		<div class="pages">
			<form>
				<table>
					<tr>
						<th>邮件标题</th>
						<th>内容</th>
						<th>是否已读</th>
						<th>时间</th>
						<th>操作</th>
					</tr>
					<s:iterator value="#request.emails" status="eStatus" id="email">
						<s:if test="%{#email.status}"></s:if>
						<s:else>
						<tr>
							<td><a href="#" onclick="emailDetails(<s:property value='#email.eid'/>)"><s:property value="#email.title"/></a></td>
							<s:if test="#email.details!=null">
								<td><s:property value="#email.details.substring(0,10)"/>...</td>
							</s:if>
							<s:else><td></td></s:else>
							<s:if test="%{#email.isRead}"><td>已读</td></s:if>
							<s:else><td>未读</td></s:else>
							<td><s:property value="#email.sendTime.toString().substring(0,10)"/></td>
							<td><input type="button" onclick="delMail((<s:property value='#email.eid'/>))" class="deleteMail" onmouseover="changeColor(this)" onmouseout="recoverColor(this)" value="删除"/></td>
						</tr>
						</s:else>
					</s:iterator>
					
				</table>
			</form>
				
		</div>
	</div>
</body>
</html>